﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using UI.Application.Share.Reactor;

namespace UI.Application.Reactor.Converter
{
    /// <summary>
    /// 反应釜运行状态转换器
    /// </summary>
    public class ReactorStateToTextConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var state = (ReactorState)value;
            var result = string.Empty;
            if (value == null) return result;

            switch (state)
            {
                case ReactorState.None:
                    result = "待开始";
                    break;
                case ReactorState.Running:
                    result = "进行中";
                    break;
                case ReactorState.Completed:
                    result = "完成";
                    break;
                case ReactorState.Cancel:
                    result = "已中止";
                    break;
                default: return result;
            }
            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
